package com.qf.test2;

import com.qf.entity.Emp;
import com.qf.entity.Menu;
import com.qf.entity.Role;
import com.qf.service.EmpService;
import com.qf.service.RoleService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * 2019/9/29
 * Administrator
 * springdata0928
 * 面向对象面向君  不负代码不负卿
 */
public class Demo3 {
    public static void main(String[] args) {

        ApplicationContext applicationContext=
                new ClassPathXmlApplicationContext("spring-data.xml");
       RoleService roleService=(RoleService) applicationContext.getBean("roleService");
       /* Role role = roleService.findbyid(1);
        System.out.println(role.getRolename());
        List<Menu> menus = role.getMenus();
        for (Menu menu : menus) {
            System.out.printf(menu.getMenuname());
        }*/
        List<Role> roles = roleService.findbyrolename("用户添加");
        for (Role role : roles) {
            System.out.println(role.getRolename());
        }

    }
}
